#define _CRT_SECURE_NO_WARNINGS 1
#include"SeqList.h"
#include <cstddef>
void SLInit(SL *psl) {
	psl->a = 0;
	psl->size = 0;
	psl->capacity = 0;
}
void SLDestroy(SL* psl) {
	assert(psl);
	if (psl->a != NULL) {
		free(psl->a);
		psl->a = NULL;
	}
	psl->a = NULL;
	psl->size = 0;
	psl->capacity = 0;
}
void PushBack(SL* psl, SLDataType x) {
	if (psl->size == psl->capacity) {
		int newcapacity = psl->capacity == 0 ? 4 :psl->capacity * 2;
		SLDataType temp = realloc(psl->a, sizeof(SLDataType) * newcapacity);
		if (temp == NULL) {
			perror("realloc fail");
			return;
		}
		psl->a = temp;
		psl->capacity = newcapacity;
	}
}
void SLPrint(SL* psl) {
	assert(psl);
	for (int i = 0; i < psl->size; i++) {
		printf("%d ", psl->a[i]);
	}
}